package com.grf.hadoop.temp_grouping;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class TempDriver {

    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);
        job.setJarByClass(TempDriver.class);
        job.setMapperClass(TempMapper.class);
        job.setReducerClass(TempReducer.class);
        job.setMapOutputKeyClass(TempBean.class);
        job.setMapOutputValueClass(NullWritable.class);
        job.setOutputKeyClass(TempBean.class);
        job.setOutputValueClass(NullWritable.class);
        job.setGroupingComparatorClass(TempCroupingComparator.class);
        FileInputFormat.setInputPaths(job, new Path("C:\\Users\\Administrator\\Desktop\\大数据\\data\\temp1.txt"));
        FileOutputFormat.setOutputPath(job, new Path("C:\\Users\\Administrator\\Desktop\\output"));
        job.waitForCompletion(true);
    }
}
